﻿namespace PolePosition.v3.EntityFactory
{
    public sealed class QuickSearchFactory
    {
        public static string DistributionInspVisitQuickSearch(int? utilityId, int? value)
        {
            var _SqlCommand = new System.Data.SqlClient.SqlCommand();
            _SqlCommand.CommandText = "up_VendorDistributionPole_QuickSearch";

            _SqlCommand.Parameters.AddWithValue("@UtilityFk", utilityId.HasValue ? utilityId.Value : 0);
            _SqlCommand.Parameters.AddWithValue("@Vendor_Distribution_Poles_PoleId", value.HasValue ? value.Value : 0);

            return ProjectCommon2.Helpers.SqlHelper.ExecuteScalar<string>(_SqlCommand); ;
        }

        public static string XMissionInspVisitQuickSearch(int? utilityId, int? value)
        {
            var _SqlCommand = new System.Data.SqlClient.SqlCommand();
            _SqlCommand.CommandText = "up_VendorInspVisitXMissionStructurePole_QuickSearch";

            _SqlCommand.Parameters.AddWithValue("@UtilityFk", utilityId.HasValue ? utilityId.Value : 0);
            _SqlCommand.Parameters.AddWithValue("@Vendor_InspVisit_XMissionStructure_PoleID", value.HasValue ? value.Value : 0);

            return ProjectCommon2.Helpers.SqlHelper.ExecuteScalar<string>(_SqlCommand); ;
        }

        public static string AssetMeterQuickSearch(int? utilityId, string value)
        {
            var _SqlCommand = new System.Data.SqlClient.SqlCommand();
            _SqlCommand.CommandText = "up_UtilityAssetMeter_QuickSearch";

            _SqlCommand.Parameters.AddWithValue("@UtilityFk", utilityId.HasValue ? utilityId.Value : 0);
            _SqlCommand.Parameters.AddWithValue("@MeterNumber", value);

            return ProjectCommon2.Helpers.SqlHelper.ExecuteScalar<string>(_SqlCommand); ;
        }

        public static string AssetDistributionQuickSearch(int? utilityId, int? value)
        {
            var _SqlCommand = new System.Data.SqlClient.SqlCommand();
            _SqlCommand.CommandText = "up_UtilityAssetDistribution_QuickSearch";

            _SqlCommand.Parameters.AddWithValue("@UtilityFk", utilityId.HasValue ? utilityId.Value : 0);
            _SqlCommand.Parameters.AddWithValue("@UtilityAssetDistributionId", value.HasValue ? value.Value : 0);

            return ProjectCommon2.Helpers.SqlHelper.ExecuteScalar<string>(_SqlCommand);
        }

        public static string AssetXMissionQuickSearch(int? utilityId, int? value)
        {
            var _SqlCommand = new System.Data.SqlClient.SqlCommand();
            _SqlCommand.CommandText = "up_UtilityAssetXMissionStructuresPoles_QuickSearch";

            _SqlCommand.Parameters.AddWithValue("@UtilityFk", utilityId.HasValue ? utilityId.Value : 0);
            _SqlCommand.Parameters.AddWithValue("@Utility_Asset_XMissionStructures_PoleId", value.HasValue ? value.Value : 0);

            return ProjectCommon2.Helpers.SqlHelper.ExecuteScalar<string>(_SqlCommand);
        }        
    }
}
